package com.java8.ch06;

/**
 * Here,Box uses a constructor to initialize the dimensions of a box.
 * 
 * @author Administrator
 *
 */
public class BoxDemo6 {

	public static void main(String[] args) {
		Box6 mybox1 = new Box6();
		Box6 mybox2 = new Box6();
		// get Volume
		System.out.println("Mybox1's Volume is " + mybox1.volume());
		System.out.println("Mybox2's Volume is " + mybox2.volume());
	}
}

class Box6 {

	double width;
	double height;
	double depth;

	public Box6() {
		System.out.println("Constructing Box.");
		width = 10;
		height = 10;
		depth = 10;
	}

	// compute and return volume of a box
	double volume() {
		return width * height * depth;
	}

}